package com.falcon.tools.controller;

import com.falcon.core.controller.IBaseController;
import com.falcon.core.domain.BaseResponse;
import com.falcon.tools.domain.ApiSyncResult;
import com.falcon.tools.service.IApiMetaService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@Slf4j
@RestController
@RequestMapping("/tools/apiMeta")
@Tag(name = "ApiMetaController", description = "Api 同步工具")
public class ApiMetaController implements IBaseController {

    @Autowired
    private IApiMetaService controllerMetaService;

    @Operation(summary = "同步Api")
    @PostMapping("/sync")
    public BaseResponse<ApiSyncResult> sync() {

        ApiSyncResult apiSyncResult = this.controllerMetaService.initApi();

        return BaseResponse.success(apiSyncResult);
    }

}

